{% extends "double.html" %}
{% block title %}{{ page_title }}{% endblock %}
{% block styles %}
    <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}styles/user_index.css">
{% endblock %}
{% block scripts %}
    <script type="text/javascript">
        $(document).ready(function(){
            var sectionheight = $('section').height();
            $('aside').height(sectionheight);
        })
    </script>
{% endblock %}
{% block main %}  

<div class="profiles">
    <div class="avatar"><img src="{{ avatar_url }}"></div>
    <div class="profile">
        <h3>{{ taruser.profile.nickname }}</h3>
        <span><label>个人主页: </label><a href="{{ taruser.profile.homepage }}">{{ taruser.profile.homepage|default:'未填写' }}</a></span><br />
        <span><label>个人简介: </label>{{ taruser.profile.about }}</span><br />
        <span><a href="{% url mblog_privatemsg_add user.username taruser.username  %}">发送私信</a></span>

    </div>
    <div class="clear"></div>
</div>
<div class="bloglist">
    <h3>{{ taruser.username }}的微博</h3>

    <div class="message">
        {% if messages %}
        <ul class="messages">
            {% for message in messages %}
                <li>{{ message }}</li>
            {% endfor %}
        </ul>   
        {% endif %}
    </div>
    <ul>
        {% if tweets %}
            {% for tweet in tweets %}
                <li>
                    <div class="avatar50">
                        <img src="{{ avatar_50_url }}">
                    </div>
                    <div class="tweetgroup">
                        <div class="tweet">
                            <p>{{ tweet.message|urlize }}</p>
                            <em>{{ tweet.addtime_format_admin }}</em>
                        </div>
                        {% if tweet.orginmessage %}
                            <div class="origntweet">
                                <a class="tweetuser" href="{{ tweet.orginmessage.user.get_user_index_url }}">@{{ tweet.orginmessage.user.username }}: </a>
                                <div class="retweetcontent">{{ tweet.orginmessage|urlize }}</div>
                                <em class="readdtime">{{ tweet.orginmessage.addtime_format_admin }}</em>
                            </div>
                        {% endif %}
                        <div class="clear"></div>
                    </div>


                    <div class="operating">
                        <a href="{% url mblog_tweet_del taruser.username tweet.id %}">删除</a>
                    </div>
                    <div class="clear"></div>
                </li>
            {% endfor %}
        {% else %}
            <li class="nonetweet"><a href="{% url mblog_home %}">还没有发微薄，快去发几条试试吧</a></li>
        {% endif %}
    </ul>
</div>

{% include 'include/paginator.html' %}

{% endblock %}
{% block aside %}
    <div class="userinfo">
        <div class="asideavatar50">
            <img src="{{ MEDIA_URL }}avatar/50/{{ taruser.profile.avatar }}" class="img_avatar" alt="我的头像" />
        </div>
        <a href="{{ taruser.profile.get_user_index_url }}">{{ taruser.username }}</a>
        <div class="clear"></div>
    </div>
    <ul id="user_stats">
        <li><a href="{% url mblog_followers taruser.username %}"><span class="count">{{ taruser.follower_set.count }}</span><span class="label">关注者</span></a></li>
        <li><a href="{% url mblog_fans taruser.username %}"><span class="count">{{ taruser.fan_set.count }}</span><span class="label">粉丝</span></a></li>
        <li><a href=""><span class="count">{{ taruser.tweet_set.count }}</span><span class="label">消息</span></a></li>
        <li><a href="{% url mblog_favoritelist taruser.username %}"><span class="count">{{ taruser.favorite_set.count }}</span><span class="label">收藏</span></a></li>
    </ul>
{% endblock %}